import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import axios from './utils/axios'
import { useUserStore } from './stores/user'
import i18n from './i18n'

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)
app.use(router)
app.use(ElementPlus)
app.use(i18n)

// Set up global axios instance
app.config.globalProperties.$axios = axios

// Initialize authentication state
const userStore = useUserStore()
await userStore.initializeAuth()

// Note: WebSocket connection initialization is handled in App.vue
// No need to initialize it again here

app.mount('#app')
